package word417.jiekl;

public class ComparableTriangle extends Triangle
        implements Comparable<ComparableTriangle>{

    public ComparableTriangle(double bottom, double high) {
        super(bottom,high);
    }



    public int compareTo(ComparableTriangle o) {
        int result;
        if (getArea() > o.getArea()) {
            result = 1;
        } else if (getArea() < o.getArea()) {
            result = -1;
        } else {
            result = 0;
        }
        return result;
    }

    public String toString() {
        return "Bottom: " + getBottom() + " high: " + getHigh() +
                " Area: " + getArea();
    }

}
